package com.scy.hospitalmanager.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.scy.hospitalmanager.dao.administratordao.PatientMsgDao;
import com.scy.hospitalmanager.dao.patientdao.PatientDailySignsDao;
import com.scy.hospitalmanager.pojo.Patient;
import com.scy.hospitalmanager.pojo.PatientDailySigns;
import com.scy.hospitalmanager.pojo.PatientPhysicianOrder;
import com.scy.hospitalmanager.service.PatientService;
import com.scy.hospitalmanager.until.GetPageNum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Random;

/**
 * @Author Song_can_yu
 * @ClassName PatientPhysicianOrder
 * @Date 2021-08-07-17:21
 * @PackageName com.scy.hospitalmanager.pojo
 * @Description 病人数据管理实现
 */
@Service
public class PatientServiceImpl implements PatientService {
    @Autowired
    PatientMsgDao patientMsgDao;
    @Autowired
    PatientDailySignsDao patientDailySignsDao;
    Random random = new Random();
    /**
     * @return List
     * @Author Song_can_yu
     * @Description //TODO 查看所有患者
     * @Param null
     */
    @Override
    public PageInfo<Patient> getAllPatients(GetPageNum getPageNum) {
        PageHelper.startPage(getPageNum.getPageNo(), getPageNum.getPageSize());
        PageInfo<Patient> pageInfo = new PageInfo<>(patientMsgDao.getAllPatients());
        return pageInfo;
    }

    @Override
    public Patient getPatientById(Patient patient) {
        return patientMsgDao.getPatientById(patient);
    }

    /**
     * 通过患者id查询患者体征信息 测试
     */

    @Override
    public PatientDailySigns getDailySignsByPatientId(Patient patient) {
        return patientDailySignsDao.getDailySignsByPatientId(patient);
    }

    @Override
    public int insertPatientPhysicianOrder(PatientPhysicianOrder patientPhysicianOrder) {
        return patientMsgDao.insertPatientPhysicianOrder(patientPhysicianOrder);
    }

    @Override
    public int deletePatientPhysicianOrderById(PatientPhysicianOrder patientPhysicianOrder) {
        return patientMsgDao.deletePatientPhysicianOrderById(patientPhysicianOrder);
    }

    @Override
    public void insertManyPatient(Patient patient) {
                    patientMsgDao.insertPatient(patient);
    }
}
